<!DOCTYPE html>
<html>
<head>
	<title>绘制一个填充的三角形</title>
	<style type="text/css">
		canvas{
			border: 1px solid #ccc;
		}
	</style>
</head>
<body>
<canvas width="600" height="400"></canvas>
<script type="text/javascript">
var myCanvas = document.querySelector('canvas');
var ctx = myCanvas.getContext('2d');

ctx.moveTo(100,100);
ctx.lineTo(200,100);
ctx.lineTo(200,200);

ctx.closePath();

ctx.lineWidth = 10;
ctx.fill();
ctx.stroke();

</script>
</body>
</html>